// 第二个参数为是否包含子文件夹
const req = require.context('./js', false, /\.js$/);
const requireAll = requireContext => requireContext.keys().map(requireContext);
let directives = requireAll(req);

const install = Vue => {
  directives.forEach(item => {
    Object.keys(item).forEach(key => {
      Vue.directive(key, item[key]);
    });
  });
};

export default {
  install
};
